<?php

namespace App\Admin\Renderable;

use Dcat\Admin\Support\LazyRenderable;
use Faker\Factory;
use Dcat\Admin\Widgets\Table;
use Dcat\Admin\Admin;

class ReportDetail extends LazyRenderable
{
    public function render()
    {
    }

    public function makeCustomerDetail($arr, $config)
    {

        // dd($arr, $config);
        $title = [];
        $data = [];
        foreach ($config as $k => $v) {
            $title[] = $k;
        }
        if (!is_array($arr)) {
            return Table::make($title, []);
        }
        foreach ($arr as $k => $v) {
            $temp = [];
            foreach ($config as $kk => $vv) {
                array_push($temp, $v[$vv] ?? '-');
            }
            $data[] = $temp;
        }
        // dd($title, $data);
        return Table::make($title, $data);
    }
}
